﻿using FastReport;
using FastReport.DevComponents.DotNetBar.Controls;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace biaoqian
{
    public partial class Dayin : Form
    {
        public Dayin()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            Report report = new Report();
            DataSet ds = new DataSet();
            DataTable dt1 = new DataTable("测试2");
            dt1.Columns.Add("时间");
            dt1.Columns.Add("打印人");
            dt1.Rows.Add("2020-01-01", "管理员");
            dt1.Rows.Add("2020-02-02", "管理");
            ds.Tables.Add(dt1.Copy());
            report.RegisterData(ds);
            //动态添加参数
            report.SetParameterValue("测试参数名", "测试值");
            //获取指定名称的数据源
            report.GetDataSource("测试2").Enabled = true;
            //调出设计器
            report.Design();
            //显示预览窗口
            report.Show();
            report.Dispose();
        }

        private void Button2_Click(object sender, EventArgs e)
        {
            //获取文件路径
            string LUJIN = AppDomain.CurrentDomain.BaseDirectory;
            string  die = Path.Combine(LUJIN, "Fastreport\\Heshuo1.frx");
            DirectoryInfo parentDir = Directory.GetParent(LUJIN);
            this.textBox1.Text= LUJIN;
            this.textBox2.Text= die;
            this.textBox3.Text= parentDir.FullName;
            var ZhuL = "D:\\兰多项目\\兰多开发清单\\兰多开发清单\\biaoqian\\biaoqian\\Fastreport";
            var HeSo = "Heshuo1.frx";
            this.textBox8.Text = Path.Combine(ZhuL, HeSo);

        }
    }
}
